home *** CD-ROM | disk | FTP | other *** search
- Path: news.primenet.com!not-for-mail
- From: kj7bg@primenet.com (Bob White)
- Newsgroups: comp.lang.c++
- Subject: Re: question about string class
- Date: 11 Mar 1996 09:01:00 -0700
- Organization: Primenet Services for the Internet
- Sender: root@primenet.com
- Distribution: inet
- Message-ID: <4i1ins$6hm@nnrp1.news.primenet.com>
- References: <izrhgvwsov1.fsf@potkulauta.cs.hut.fi>
- X-Posted-By: ip161.boi.primenet.com
- X-Newsreader: WinVN 0.99.7
- MIME-Version: 1.0
- Content-Type: Text/Plain; charset=US-ASCII
-
- I believe that you would use the following:
-
- To empty a string, use the "resize" method.
- string text = "something";
- text.resize( 0 );
-
- To alter a specific character, use operator [].
- string text = "something";
- text[8] = '!';
-
- Hope that helps.
- Bob
-
- In article <izrhgvwsov1.fsf@potkulauta.cs.hut.fi>, hazor@potkulauta.cs.hut.fi
- says...
- >
- >Where can I find information about the methods inside the string class
- >that comes with c++ (g++, #include <string>) ...?
- >
- >I need to know how can I empty my string, like if I have
- >string text;
- >text = "something";
- >text.empty();
- >
- >--> I want text to be empty but empty() method does not seem to work?
- >what is the right one?
- >
- >and then I want to know how to put a specific char into specifix place
- >in my string...
- >for example , I want to change the "something" into "somethin!"
- >what method does that?
- >
- >please, give me few examples about doing these...
- >--
- >Tommi Lahtonen, tlahtone@snakemail.hut.fi, URL: http://www.hut.fi/~tlahtone
- >
- >There is no point in being grown up if you can't be childish sometimes. -Dr.
- Who
-
-